/**
 * @author        Nicolas Bottarini <nicolasbottarini@gmail.com>, 404 <http://www.proyecto404.com>
 * @version       $Rev: 3 $
 * @lastrevision  $Date: 2011-09-12 16:45:37 +0000 (Mon, 12 Sep 2011) $	 
 */
package com.proyecto404.core {
	
	import com.proyecto404.core.exception.ArgumentException;
	import com.proyecto404.core.exception.ArgumentNullException;
	import com.proyecto404.core.exception.ArgumentOutOfRangeException;
	import com.proyecto404.core.util.StringHelper;
	import com.proyecto404.core.exception.ArgumentException;
	import com.proyecto404.core.exception.ArgumentNullException;
	import com.proyecto404.core.exception.ArgumentOutOfRangeException;
	
	/**
	 * For internal use by the Check class
	 */
	public class Argument {
		public function isNotEmpty(argument:String, argumentName:String):void {
			if (argument == null || StringHelper.trim(argument) == "") {
				throw new ArgumentException(argumentName, StringHelper.formatWith("{0} cannot be blank", argumentName));
			}
		}

		public function isNotOutOfLength(argument:String, length:int, argumentName:String):void {
			if (StringHelper.trim(argument).length > length) {
				throw new ArgumentException(StringHelper.formatWith(argumentName, "{0} cannot be more than {1} character.", argumentName, length));
			}
		}
		
		public function isNotNull(argument:Object, argumentName:String):void {
			if (argument == null) {
				throw new ArgumentNullException(argumentName);
			}
		}
		
		public function isNotNegative(argument:int, argumentName:String):void {
			if (argument < 0) {
				throw new ArgumentOutOfRangeException(argumentName);
			}
		}

		public function isNotNegativeOrZero(argument:int, argumentName:String):void {
			if (argument <= 0) {
				throw new ArgumentOutOfRangeException(argumentName);
			}
		}

	}
}